#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ordered_set tree<pair<int, int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
#define all(v) (v).begin(),(v).end()
#define r_all(v) (v).rbegin(),(v).rend()
#define s(v) (v).size()
#define endl "\n";
#define NO cout << "NO\n";
#define YES cout << "YES\n";
#define No cout << "No\n";
#define Yes cout << "Yes\n";
#define PF push_front
#define PB push_back
#define MP make_pair
#define F first
#define S second
const int MOD = 1e9 + 7;
const int N = 1e6 + 5;
//_____________________________________________________Mostly_used______________________________________________________
void print_vec(vector<ll>& v){
for(ll i=0; i<s(v); i++) cout << v[i] << " ";
cout << endl
}
bool is_sorted(vector<ll>& v){
bool x = true;
for(ll i=0; i<s(v)-1; i++) x &= (v[i] <= v[i+1]);
return x;
}
bool is_palindrome_s(string s) {
string p = s;
reverse(all(p));
if (s == p) return true;
else return false;
}
bool is_palindrome_n(ll n) {
ll temp = n, sum =0 ,r;
while(n>0)
{
r=n%10;
sum = (sum*10)+r;
n/=10;
}
if (temp == sum) return true;
else return false;
}
//_____________________________________________________/Mostly_used_____________________________________________________
int main() {
fast
ll n, m; cin >> n >> m;
ll ans = n;
vector<ll> deg(n+1, 0);
while(m--){
ll u, v; cin >> u >> v;
if(u < v) swap(u, v);
if(!deg[v]) ans--;
deg[v]++;
}
ll q; cin >> q;
while(q--){
ll type, u, v; cin >> type;
if(type == 1){
cin >> u >> v;
if(u < v) swap(u, v);
if(!deg[v]) ans--;
deg[v]++;
}
else if(type == 2){
cin >> u >> v;
if(u < v) swap(u, v);
deg[v]--;
if(deg[v] == 0) ans++;
}
else if(type == 3){
cout << ans << endl
}
}
return 0;
}
416. Partition Equal Subset Sum | 1446. Consecutive Characters |
1618A - Polycarp and Sums of Subsequences | 1618B - Missing Bigram |
938. Range Sum of BST | 147. Insertion Sort List |
310. Minimum Height Trees | 2110. Number of Smooth Descent Periods of a Stock |
2109. Adding Spaces to a String | 2108. Find First Palindromic String in the Array |
394. Decode String | 902. Numbers At Most N Given Digit Set |
221. Maximal Square | 1200. Minimum Absolute Difference |
1619B - Squares and Cubes | 1619A - Square String |
1629B - GCD Arrays | 1629A - Download More RAM |
1629C - Meximum Array | 1629D - Peculiar Movie Preferences |
1629E - Grid Xor | 1629F1 - Game on Sum (Easy Version) |
2148. Count Elements With Strictly Smaller and Greater Elements | 2149. Rearrange Array Elements by Sign |
2150. Find All Lonely Numbers in the Array | 2151. Maximum Good People Based on Statements |
2144. Minimum Cost of Buying Candies With Discount | Non empty subsets |
1630A - And Matching | 1630B - Range and Partition |